<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var array=[33,55,22,56,87,98];

        for(var j=0;j<array.length-1;j++){
            for(var i=0;i<array.length-1-j;i++){
                if(array[i]>array[i+1]){
                    var t;
                    t=array[i];
                    array[i+1]=array[i];
                    array[i+1]=t;
                }
            }
        }
        console.log(array);
    </script>
</body>
</html>